package com.token.iot.bratterycharging.gateway.business;

import com.outstanding.framework.core.PendingException;
import com.token.iot.bratterycharging.gateway.ResCode;

/**
 * 一些工具类
 * @author chenzhixuan
 *
 */
public class Tools {
	
	
	/**
	 * 
	 * @param str
	 * @return 补上两位的长度码
	 * @throws PendingException
	 */
	static public String addLengthFlag(String str) throws PendingException {
		if(str == null) {
			throw new PendingException(ResCode.CommandNULL);
		}
		int length = str.length();
		String lengthStr = String.format("%02d", length);
		return lengthStr+str;
		
		
	}

}
